<?
$i=1;
while ($value = mysql_fetch_assoc($resultR)) {
	if (($i % 2) > 0) { $class = 'ulHome'; }
	else { $class = 'ulHome altRow'; }

	$linkID = $value[LinkID];
	$linkPath = $value[Path];
	$linkTitle = stripslashes($value[Title]);
	$linkDescription = stripslashes($value[LinkDescription]);
	$link            = $value[Link];
	$linkUserID      = $value[UserID];
	$linkDateCreated = $value[DateCreated];
	$linkViews       = $value[Views];
	$linkRank        = $value[RankTotal];
	
	// Check linkPath and see if we're viewing forms
	// If so, remove the rank widget
	if (substr($linkPath,1,1) == 'f') { $noWidget = 1; }
	
	if ($linkViews == 1) { $linkViewsText = 'View'; }
	else { $linkViewsText = 'Views'; }
	
	echo "<ul class=\"$class\"><li>\n";
	echo "<table style=\"width: 100%;\">\n";
	echo "<tr><td style=\"width: 75px; text-align: center; vertical-align: top;\">";
	
	// Rank system goes here
	if ($noWidget != 1) {
		echo "<span id=\"rankText_".$linkID."\" style=\"color: #999;\">Rank</span>";
		echo "<div id=\"rankBox_".$linkID."\" class=\"rankBox rankGreen\">".$linkRank."</div>\n";
		echo "<div id=\"rankControls_".$linkID."\" class=\"rankControls\">\n";
		echo "<a href=\"#\" onClick=\"logRank('down',".$linkID.",'".$linkRank."'); return false;\"><img src=\"images/buttonRankDown.gif\" style=\"border: none;\" alt=\"Not so good\"></a>\n";
		echo "<a href=\"#\" onClick=\"logRank('up',".$linkID.",'".$linkRank."'); return false;\"><img src=\"images/buttonRankUp.gif\" style=\"border: none;\" alt=\"I love it\"></a>\n";
		echo "</div>";
	}	
	
	echo "</td><td>\n";
	echo "<a href=\"$siteURL/linkViewPopup.php?linkID=$linkID\" target=\"_blank\">$linkTitle</a>\n";
		
	echo "<div style=\"width: 100%; padding-top: 5px; padding-bottom: 5px;\">\n";	
	if ( ($linkDateCreated != "0000-00-00") && (!empty($linkDateCreated)) ) { 
		echo "<span class=\"date\">";
		mysql_to_date($linkDateCreated);
		echo "</span> &nbsp;&nbsp;<img src=\"images/icon_small_view.gif\" alt=\"$linkViews $linkViewsText\"> <span style=\"color: #999;\">$linkViews $linkViewsText</span>";
		echo "&nbsp;&nbsp;&nbsp;<img src=\"images/iconUnlink.gif\" alt=\"Report broken link\" />";
		echo "<span id=\"badLink$linkID\"><a href=\"#\" style=\"font-size: 1em; font-weight: normal;\" onClick=\"badLink($linkID); return false;\">Report broken link</a></span>";
		echo "</div>";
	}	
	echo "$linkDescription";
	echo "</td></tr></table>\n";
	echo "</li></ul>\n";
	
	$i++;
}
?>